﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Skugo.Shared;
using System.Windows.Media.Imaging;

namespace Skugo.StandardPlugins
{
    public static class IconLoader
    {
        private static Dictionary<Icon, BitmapImage> Cache = new Dictionary<Icon, BitmapImage>();

        public static BitmapImage Load(Icon icon)
        {
            if (icon != Icon.None)
            {
                if (Cache.ContainsKey(icon))
                {
                    return Cache[icon];
                }
                else
                {
                    var uri = new Uri(@"pack://application:,,,/Skugo.StandardPlugins;component/Icons/" + icon.ToString() + ".png");
                    var image = new BitmapImage(uri);
                    Cache[icon] = image;
                    return image;
                }
            }
            else
            {
                return null;
            }
        }
    }
}
